package array

import "fmt"

func Join (array []string, separator ...string) string {
	sep := ","
	if len(separator) > 0 {
		sep = separator[0]
	}
	ret := ""
	for idx, value := range array {
		if idx > 0 {
			ret = fmt.Sprintf("%v%v%v", ret, sep, value)
		} else {
			ret = fmt.Sprintf("%v%v", ret, value)
		}
	}
	return ret
}